﻿
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Text;
using Microsoft.Practices.Repository;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DotNetCore.BannerManagement.Domain;
using DotNetCore.BannerManagement.Domain;
using System.Data.SqlClient; 

namespace DotNetCore.BannerManagement.DAL.Domain.dnc_ZoneImageRepositoryArtifacts
{
    /// <summary>
    /// Construct a List<dnc_ZoneImage> collection from an IDataReader object.
    /// </summary>
    internal class GetAllFromdnc_ZoneImageFactory : IDomainObjectFactory<dnc_ZoneImage>
    {        
        public List<dnc_ZoneImage> Construct(IDataReader reader)
        {
			List<dnc_ZoneImage> dnc_ZoneImageList = new List<dnc_ZoneImage>();

            // Process first cursor
			while (reader.Read())
            {
                dnc_ZoneImage dnc_ZoneImage = new dnc_ZoneImage();                		    
			int idIndex = reader.GetOrdinal("Id"); 
            if(!reader.IsDBNull(idIndex))
            {
                dnc_ZoneImage.Id= reader.GetInt32(idIndex);

			}
			int imageHeightIndex = reader.GetOrdinal("ImageHeight"); 
            if(!reader.IsDBNull(imageHeightIndex))
            {
                dnc_ZoneImage.ImageHeight= reader.GetDecimal(imageHeightIndex);

			}
			int imageWidthIndex = reader.GetOrdinal("ImageWidth"); 
            if(!reader.IsDBNull(imageWidthIndex))
            {
                dnc_ZoneImage.ImageWidth= reader.GetDecimal(imageWidthIndex);

			}
			int nameIndex = reader.GetOrdinal("Name"); 
            if(!reader.IsDBNull(nameIndex))
            {
                dnc_ZoneImage.Name= reader.GetString(nameIndex);

			}
          
        dnc_ZoneImageList.Add(dnc_ZoneImage);
        }

			return dnc_ZoneImageList; 
        }

        #region IDomainObjectFactory<dnc_ZoneImage> Members

        dnc_ZoneImage IDomainObjectFactory<dnc_ZoneImage>.Construct(IDataReader reader)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}

